-- UNITDEF -- Rook --
--------------------------------------------------------------------------------

local unitName = "Rook"

--------------------------------------------------------------------------------

local unitDef = {
  acceleration       = 1,
  brakeRate          = 1,
  buildCostMetal     = 10,
  canAttack          = true,
  canDGun			 = true,
  canMove            = true,
  canstop            = 1,
  category           = [[PLAYER UNARMORED UNIT TARGET]],
  collisionvolumetest = 1,
    customParams        = {
   	toggle1 = 2,
	toggle1on = [[Secondary]],
	toggle1off = [[Primary]],
	toggle1tooltip = [[Switch between weapons]],
    helptext       = [[The Rook specializes in Heavy Armor. It has a rocket launcher as a secondary weapon]],
     },
  corpse              = [[DEAD]], 
  description        = [[Heavy]],
  energyMake         = 0,  --0 sec to recharge
  energyStorage      = 0,
  explodeAs          = [[Death]],
  footprintX         = 2,
  footprintZ         = 2,
  iconType           = [[armor]],
  idleAutoHeal       = 0,
  idleTime           = 30,
  levelGround        = false,
  maxDamage          = 1500,
  maxthisunit        = 1,
  maxVelocity        = 2,	-- walk was 2
  metalMake          = 0,
  metalStorage       = 0,
  movementClass      = [[ENGINE]],
  name               = [[Hachiman]],  ---J:Hachiman =shinto god of wa K:Hyeonmu =tortoise gaurdian
  noChaseCategory    = [[NOTARGET]],
  objectName         = [[Rook.s3o]],
  radarDistance      = 0,
  reclaimable        = false,
  seismicSignature   = 1,
  selfDestructAs     = [[Death]],
  selfDestructCountdown = 1,
  showNanoFrame      = false,
  showPlayerName     = true,
  sightDistance      = 900, --- pawn 800 player 900?
  smoothAnim         = true,
  turnInPlace	    = 1,  --need for strafing
  turnRate           = 1500, ---used to be 3000
  unitname           = [[Rook]],
  upright            = true,
  sfxtypes = {
    explosiongenerators = {
	[[custom:flashmuzzle1]],
	[[custom:missileshot]],
	[[custom:burning]],
	[[custom:JumpImpact]],
    },
  },
  -- sounds = {
    -- arrived = {
      -- [[commandgiven]],
    -- },
    -- ok = {
      -- [[commandgiven]],
    -- },
    -- select = {
      -- [[select]],
    -- },
  -- },
  weapons = {
    [1]  = {
      def                = [[gunr1]],
      onlyTargetCategory = [[TARGET]],
      mainDir            = [[0 0 1]], --- wont read quotes
      maxAngleDif        = 170,
    },
    [2]  = {
      def                = [[smallr1]],
      onlyTargetCategory = [[TARGET]],
	  mainDir            = [[0 0 1]], --- wont read quotes
      maxAngleDif        = 170,
    },
	[3]  = {
      def                = [[Stomp]],
	  badtargetcategory  = [[PLAYER BASE]],		
      onlyTargetCategory = [[SMALL]],
    },
	[4]  = {
      def                = [[GRENADE]],
      onlyTargetCategory = [[TARGET]],
	  mainDir            = [[0 0 1]], --- wont read quotes
      maxAngleDif        = 170,
    },
  },
}


--------------------------------------------------------------------------------

local weaponDefs = {
  gunr1 = {
    avoidFriendly      = false,
	--burst = 2,  takes too damn long and misses
	--burstrate = 0.6,
	CanAttackGround = false,
    collideFriendly    = false,
    craterBoost        = 0,
    craterMult         = 0,
    duration           = .03,
    explosionGenerator = [[custom:none]],
    id                 = 1,
    impactonly         = 1,
    impulseBoost       = 0,
    impulseFactor      = 0,
    interceptedByShieldType = 0,
    name               = [[Battle Rifle]],
    range              = 600,
    reloadtime         = 1.5,  -- was 3 but halfed since burst didnt work
    rgbColor           = [[1 0.8 0.5]],
    soundStart         = [[rookshot]],
    sprayAngle         = 400,
    thickness          = 1,
    tolerance          = 600,
    turret             = true,
    weaponType         = [[LaserCannon]],
    weaponVelocity     = 1200,
    damage = {
      default            = 60, -- 3 times knight smg
    },
  },
  
  smallr1 = {
    name = [[Rocket Launcher]], 
	id = 1,
	rendertype = 1,
	lineofsight = 1,
	turret = 1,
	ballistic = 0,
	CanAttackGround = false,
	smoketrail = 1,
	smokedelay = .1,
	model = [[srocket.s3o]],
	collideFriendly     =  false,
	accuracy = 1800,
	range = 300, --- 150 originally
	wobble = 1000,
	reloadtime = 1,
	areaofeffect = 20,
	weapontimer = 5,
	weaponvelocity = 650,
	startvelocity = 350,
	weaponacceleration = 320,
	turnrate = 1000, --counter wobble?
	metalpershot = 0,
    energypershot = 0,	
	soundstart = [[Rocket]],
	soundhit = [[medexplo]],
	soundTrigger = 1,
	firestarter = 70,
	guidance = 1,
	tracks = 1,
	selfprop = 1,
	tolerance = 1000,
	explosiongenerator = [[custom:SMALLMISSILE_EXPLOSION]],
	impulsefactor = 0,
	impulseBoost = 0,
	craterMult = 0,
	craterBoost = 0,
	startsmoke = 1,
	InterceptedByShieldType = 2,

    damage = {
      default            = 50,
    },
  },
  
  Stomp       = {
      name                    = [[Stomp]],
      areaOfEffect            = 84,
      collideFriendly         = false,
      craterBoost             = 1,
      craterMult              = 1,

      damage                  = {
        default = 0,
		small = 50,
      },

      edgeEffectiveness       = 0.5,
      explosionGenerator      = [[custom:NONE]],
      impulseBoost            = 2, --might have to adjust
      impulseFactor           = 0.2,
      intensity               = 1,
      interceptedByShieldType = 1,
      lineOfSight             = false,
      noSelfDamage            = true,
      range                   = 30,
      reloadtime              = 1,
      renderType              = 4,
      rgbColor                = [[1 1 1]],
      thickness               = 1,
      tolerance               = 100,
      turret                  = true,
      weaponType              = [[Cannon]],
      weaponVelocity          = 0.8,
    },
	
	Grenade       = {
	name = [[Grenade Launhcer]], 
	--weaponType = [[DGun]],  --- need for dgun button?
	
	CommandFire = true,  -- seems to work like this. I'm wondering how many other values you're using "1" for where in the newer convention "true" is used...
	rendertype = 6,
	ballistic = 1,
	turret = 1,
	     
    model = [[rookgren.s3o]], 

	noselfdamage = 1, ---doesnt work?
	myGravity = 0.2,
	range = 300,
	reloadtime = 60,
	weapontimer = 10, 
	weaponvelocity = 80,
    edgeEffectiveness        =  1,
	areaofeffect = 55,
	accuracy = 2400,
	groundbounce = 1,
	bounceslip = 0.5,
	bouncerebound = 0.5,
	numbounce = 2,	
	edgeeffectiveness = 1,
	minbarrelangle = -45,
	holdtime = 2,
	soundstart = [[Rocket]],
	soundhit = [[medcan]],
	tolerance = 1000,
	sprayangle = 400,
	impulsefactor = 0,
	impulseBoost = 0,
	craterMult = 0,
	craterBoost = 0,
	smoketrail = 1,
	explosionGenerator = [[custom:MISSILE_EXPLOSION]],
	startsmoke = 1,
	InterceptedByShieldType = 1, --not 2
	
	  damage                  = {
        default = 800,
		player = 400,
      },
	},
}
unitDef.weaponDefs = weaponDefs

local featureDefs = {
    DEAD  = {
      description      = [[Wreckage - Engine]],
      blocking         = true,
      category         = [[corpses]],
      damage           = 1000,
      energy           = 0,
	  featureDead      = [[HEAP]],
      featurereclamate = [[SMUDGE01]],
      footprintX       = 3,
      footprintZ       = 4,
      height           = [[20]],
      hitdensity       = [[100]],
      metal            = 0,
      object           = [[rook_dead.s3o]],
      reclaimable      = false,
      reclaimTime      = 0,
      world            = [[All Worlds]],
    },
	
	 HEAP  = {
      description      = [[Debris - Engine]],
      blocking         = false,
      category         = [[heaps]],
      damage           = 500,
      energy           = 0,
      featurereclamate = [[SMUDGE01]],
      footprintX       = 3,
      footprintZ       = 3,
      height           = [[13]],
      hitdensity       = [[100]],
      metal            = 0,
      object           = [[engine_heap.s3o]],
      reclaimable      = false,
      reclaimTime      = 0,
      seqnamereclamate = [[TREE1RECLAMATE]],
      world            = [[All Worlds]],
    },
  }
  unitDef.featureDefs = featureDefs
  
--------------------------------------------------------------------------------

return lowerkeys({ [unitName] = unitDef })

--------------------------------------------------------------------------------
